﻿using DynConDevCorp.OpenArch.SmartData.Core;
using DynConDevCorp.OpenArch.SmartData.Interfaces;
using DynConDevCorp.OpenArch.SmartData.Interfaces.EventArgClasses;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace UnitTest.DynConDevCorp.OpenArch.SmartData
{


    [TestClass]
    public class SmartEffect_UnitTests
    {


        private TestContext testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        private static void TestHandler<DATA_TYPE>(object sender, ValueChangedEventArgs<DATA_TYPE> args)
        {
            
        }
        public void Fire_UnitTestHelper<DATA_TYPE>()
        {
            EventHandler<ValueChangedEventArgs<DATA_TYPE>> handler = TestHandler;
            SmartEffect<DATA_TYPE> target = new SmartEffect<DATA_TYPE>(handler); 
            const object sender = null;
            const ISmartBase originator = null; 
            DATA_TYPE oldValue = default(DATA_TYPE);
            DATA_TYPE newValue = default(DATA_TYPE);
            ValueChangedEventArgs<DATA_TYPE> args = new ValueChangedEventArgs<DATA_TYPE>(originator, oldValue, newValue);
            target.InvokeEffect(sender, args);
        }

        [TestMethod]
        public void Fire_UnitTest()
        {
            Fire_UnitTestHelper<GenericParameterHelper>();
        }

        public void SmartEffectConstructor_UnitTest1Helper<DATA_TYPE>()
        {
            EventHandler<ValueChangedEventArgs<DATA_TYPE>> handler = TestHandler;
            SmartEffect<DATA_TYPE> target = new SmartEffect<DATA_TYPE>(handler);
            Assert.IsNotNull(target);
        }

        [TestMethod]
        public void SmartEffectConstructor_UnitTest1()
        {
            SmartEffectConstructor_UnitTest1Helper<GenericParameterHelper>();
        }

        [TestMethod]
        public void SmartEffectConstructor_UnitTest()
        {
            SmartEffect<int> target = new SmartEffect<int>(TestHandler);
            Assert.IsNotNull(target);
        }

        [TestMethod]
        public void Equals_UnitTest()
        {
            SmartEffect<int> target = new SmartEffect<int>(TestHandler);
            SmartEffect<int> target2 = new SmartEffect<int>(TestHandler);
            SmartEffect<int> target3 = new SmartEffect<int>(null);
            Assert.IsTrue(target.Equals(target2));
            Assert.IsFalse(target.Equals(target3));
            Assert.IsFalse(target.Equals(null));
        }

        [TestMethod]
        public void GetHashCode_UnitTest()
        {
            SmartEffect<int> target = new SmartEffect<int>(TestHandler);
            SmartEffect<int> target2 = new SmartEffect<int>(TestHandler);
            Assert.AreNotEqual(target.GetHashCode(), target2.GetHashCode());
        }
    }
}
